<template>
  <div class="about">
    <div class="box">
      <div class="img_top">
        <img :src="img[idx]" alt="" @click="imgs" />
      </div>
      <ul>
        <li
          v-for="(item, index) in img"
          :key="index"
          :class="{ active: idx == index }"
          @click="tab(index)"
        >
          <img :src="item" alt="" />
        </li>
      </ul>
      <div class="left">&lt;</div>
      <div class="right">&gt;</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "about",
  data() {
    return {
      idx: 0,
      img: ["images/2.jpg", "images/7.jpg", "images/8.jpg", "images/9.jpg"],
    };
  },
  computed: {},
  methods: {
    tab(index) {
      this.idx = index;
    },
    imgs(e) {
      console.log(e.target);
      console.log(this);
    },
  },
  mounted() {},
  created() {},
};
</script>
<style scoped lang="scss">
.box {
  width: 600px;
  height: 600px;
  margin: 20px auto;
  position: relative;
  .img_top {
    img {
      width: 600px;
      height: 600px;
    }
  }
  ul {
    display: flex;
    justify-content: space-around;
    align-items: center;
    li {
      list-style: none;

      .active {
        width: 175px;
        height: 100px;
        background: #000;
        opacity: 1;
        z-index: 0;
      }
      img {
        width: 100px;
        height: 100px;
      }
    }
  }
  .left {
    position: absolute;
    top: 50%;
    left: 10px;
    font-size: 50px;
    color: red;
  }
  .right {
    position: absolute;
    top: 50%;
    right: 10px;
    font-size: 50px;
    color: red;
  }
}
</style>
